<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ include file="/Pages/Jsp/Common/header.jsp"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<html>
	<head>
		<script language="javascript" type="text/javascript"
			src="<%=request.getContextPath()%>/Pages/Js/forumDetails.js"></script>
		<link type="text/css"
			href="<%=request.getContextPath()%>/Pages/Css/forum/forumDetails.css"
			rel="stylesheet" />
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/ckeditor/ckeditor.js"></script>
		<title>Forum-EKMS</title>
		<link type="text/css"
			href="<%=request.getContextPath()%>/Pages/Css/main.css"
			rel="stylesheet" />
	</head>
	<body>
		<div class="out_box">
			<div class="site_map">
				<span><a href="#">home</a> </span><span class="path_image">&gt;&gt;</span><span><a
					href="#" class="a2">forum</a> </span>
			</div>
			<div class="topic_list_container">
				<form name="topicListForm" method="post">
					<div class="topic_search">
						<h1>
							${forumName}
						</h1>
						<div class="search_area">
							<input name="forumId" style="display: none;" value="${forumId}" />
							<span class="search_title">Subject:</span>
							<input id="topicSubjectQuery" name="topicSubjectQuery"
								class="search_input" type="text" maxlength="20"
								value="${topicSubjectQuery}">
							<span class="search_title">Content:</span>
							<input id="topicContentQuery" name="topicContentQuery"
								class="search_input" type="text" maxlength="20" value="">

							<input id="hiddenTopicActiveQuery" style="display: none;"
								type="text" value="${topicActiveQuery}">
							<input id="hiddenTopicSubjectQuery" style="display: none;"
								type="text" value="${topicSubjectQuery}" />
							<!--							<input type="button" value="Search" onClick="searchTopic()" />-->
							<input type="image" class="search_img_btn"
								src="<%=request.getContextPath()%>/Pages/Images/forum/search_btn.png"
								onclick="searchTopic()"
/>
						</div>
						<div class="clear"></div>
						<div class="br"></div>
					</div>

					<div class="topic_list">
						<table class="list_table">
							<tr>
								<th class="th_a_link">
									<a onclick="sortTopic(this)"
title="subject" class="th_a_link">Subject
										Name</a>
								</th>
								<th class="th2">
									<a onclick="sortTopic(this)"
title="author" class="th_a_link">Author</a>
								</th>
								<th class="th2">
									<a onclick="sortTopic(this)";
title="repliesCount"
										class="th_a_link">Replies</a>
								</th>
								<th class="th2">
									<a onclick="sortTopic(this)";
title="viewsCount" class="th_a_link">Views</a>
								</th>
								<th class="th2">
								<a onclick="sortTopic(this);" title="lastPostTime" class="th_a_link">Last Post</a>
									
								</th>
							</tr>
							<logic:iterate id="topicInfo" name="topicInfoList"
								type="com.capgemini.fs.app.ekms.service.util.data.TopicInfo">
								<tr>
									<td style="display: none">
										<input id="Id" title="topicId" value="${topicInfo.id}" />
									</td>
									<td class="subject_td">
										<input style="display: none" id="topicSubject"
											value="${topicInfo.subject}" />
										<span id="topicSubject" class="subject"> <a href="#"
											class="subject" name="${topicInfo.id}"
											onclick=
	showTopicDetail(this);
> ${topicInfo.subject}</a> </span>
									</td>
									<td class="td_center">
										<input style="display: none" id="topicAuthor"
											value="${topicInfo.author.userName}" />
										<span id="topicAuthor"> <a href="#" class="user_name">
												${topicInfo.author.userName}</a> </span>
									</td>
									<td class="td_center">
										<input style="display: none" id="repliesCount"
											value="${topicInfo.repliesCount}" />
										<span id="repliesCount"> <span class="number">
												${topicInfo.repliesCount}</span> </span>
									</td>
									<td class="td_center">
										<input style="display: none" id="viewsCount"
											value="${topicInfo.viewsCount}" />
										<span id="viewsCount"> <span class="number">
												${topicInfo.viewsCount}</span> </span>
									</td>
									<td>
										<div>
											<logic:notEmpty name="topicInfo" property="lastPost">
												${topicInfo.lastPost.author.userName}
											</logic:notEmpty>
											<logic:empty name="topicInfo" property="lastPost">
												No Posts
											</logic:empty>

										</div>
										<div>
											<logic:notEmpty name="topicInfo" property="lastPost">
												${topicInfo.lastPost.createDate}
											</logic:notEmpty>
										</div>
									</td>

								</tr>
							</logic:iterate>
						</table>
					</div>
					<div id="pageLinks">
						<a href="#" onclick="goToFirstPage();"> First Page </a>
						&nbsp;&nbsp;
						<a href="#" onclick="goToPreviousPage();"> Previous Page </a>
						&nbsp;&nbsp;
						<input readonly="readonly" class="span-2" id="currentPage"
							value="${totalPage}" />
						&nbsp;&nbsp;
						<a href="#" onclick="goToNextPage();"> Next Page </a> &nbsp;&nbsp;
						<a href="#" onclick="goToLastPage();"> Last Page </a> &nbsp;&nbsp;
						<input class="span-1" name="targetPage" id="pageNum" />
						<input style="display: none" name="nowPage" value="${nowPage}"></input>
						<input style="display: none" name="totalPage"
							value="${totalPageNum}"></input>
						<a href="#" onclick="goToPage();"/>Go To</a>
					</div>
					<input style="display: none" id="hiddenForumID" name="forumId">

					<input id="sortType" name="sortType" style="display: none"
						value="${sortType}"></input>
					<input id="sortOrder" name="sortOrder" style="display: none"
						value="${sortOrder}"></input>
					<div class="clear"></div>
				</form>
				<form action="/EKMS-web/forum/createTopic.do" method="post"
					name="create_topic_form">
					<div>
						<div class="new_topic_title">
							New Topic
						</div>
						<div class="br"></div>
						<div class="subject_input">
							<label for="newTopicSubject">
								Subject:
							</label>
							<input type="text" name="newTopicSubject"
								class="subject_text_input" />
						</div>
					</div>
					<div>
						<div>
							<textarea id="editor1" name="newTopicContent">
							
							</textarea>
							<script type="text/javascript">
	CKEDITOR.replace('editor1', {
		toolbar : 'Basic'
	});
</script>
						</div>
						<input name="forumId" style="display: none;" value="${forumId}" />
						<div class="new_topic_submit">
							<a title="Post Topic" id="create_topic_link"
								onclick=
	newTopic(this);
><span class="left"><span
									class="creat_topic_link_btn">New Topic</span> </span> </a>
						</div>

					</div>
				</form>
			</div>
		</div>
		<jsp:include page="/Pages/Jsp/Common/footer.jsp"></jsp:include>
	</body>
</html>